/*************************************************************************
	> File Name: 4.fenzu.cpp
	> Author: hug
	> Mail: hug@haizeix.com
	> Created Time: 日  2/ 9 19:32:38 2025
 ************************************************************************/

#include <iostream>
#include <vector>
using namespace std;

int n;
vector<int> zu[10];

void output(int k) {
    for (int i = 0; i < k; i++) {
        for (auto x : zu[i]) cout << x;
        cout << " ";
    }
    cout << endl;
    return ;
}

void dfs(int ind, int k) {
    for (int i = 0; i <= k; i++) {
        zu[i].push_back(ind);
        if (ind == n) {
            if (i < k) output(k);
            else output(k + 1);
        } else if (i < k) {
            dfs(ind + 1, k);
        } else {
            dfs(ind + 1, k + 1);
        }
        zu[i].pop_back();
    }
    return ;
}

int main() {
    cin >> n;
    dfs(1, 0);
    return 0;
}
